

<%@ page language="java" errorPage="/CustomError.jsp" pageEncoding="UTF-8"%>
<%request.getRequestDispatcher("/jsp/BaseInclude.jsp").include(request, response);%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ page import="com.aurionpro.cashpro.commons.web.utils.SessionManager" %>
<%
	String mode = request.getParameter("mode");
	if("viewchangeinfo".equalsIgnoreCase(mode))
		mode = "view";
      String listType = request.getParameter("type");
      String applicationDate = SessionManager.getInstance().getTicket(session).getApplicationDate();
   
%>
   <script language="javascript">
	 	// Cancel link pointing to the authorised page
		var cancelLink = "toModule.do?prefix=/jsp/Commons&page=/bankaccountlist.do&type=<%=listType%>" + appendTokenId();
		
		// It will be used when cancel button is clicked
		var bCancel = false;
		
		// For View data of xml file. -- Modified data
		function viewPreviousData()
		{
			var parentId = encodeId(document.BankAccountForm.id.value);
			showModalDialog(
		   "toModule.do?prefix=/jsp/Commons/Masters&page=/bankaccount.do&method=show&screenFrom=edit&lastAction=&mode=viewchangeinfo&<%=SessionManager.getInstance().getToken(request.getSession())%>&type=<%=listType%>&id="+parentId + appendTokenId(), "", "dialogWidth:950px;dialogHeight:450px");

		}						
		
		function onchange_branch(){
		
			document.BankAccountForm.branchId.value=document.BankAccountForm.branchname.options[document.BankAccountForm.branchname.selectedIndex].value;
	       
	        }
		
		window.onload = function() {
		   disabledEnabledFieldForLastAction("", document.BankAccountForm.lastAction.value, "<%=request.getParameter("mode")%>"); 
		   makeAJAXRequests();
			
			}
				
				
		function makeAJAXRequests() {
		
			 var branchObj = new AJAXCallWithStatusImage("toModule.do?prefix=/jsp/Commons/Masters&page=/organizationunit.do&method=list&listtype=authorized" + appendTokenId(), fillCombo,"branchname", document.BankAccountForm.branchId.value,"branchImage");
	 		   branchObj.doGet();
	           }
	

		// Called when form is submitted
		function validateInputForm(form)
		{
		
			if(bCancel) 
			{
		
				window.location.href = cancelLink;
				return false;
			}
			else 
			{
				return frmSubmit();
				return true;
			}
		}

		
		function frmSubmit()		 
		{
				if(!checkInvalidChars(document.BankAccountForm.accountNumber))
			     	return false;
			     	
			     if ( !checkCombo(document.BankAccountForm.branchname))
			      return false;	
			      
			     if(!checkNum(document.BankAccountForm.accountNumber))
				  return false;
			
	}

</script>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html>
<head>
	<html:base />
	
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
</head>
<body class="bg">


	<html:form action="/bankaccount" method="post" onsubmit="return validateInputForm(this)">
		<table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablebg">
			<tr>
				<td>

					<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center" class="tablebg">
						<tr class="tablebg">
							<td class="boldtext">
								<b>
								 :: <bean:message key="bankaccount.title" />:: 
								</b>
							</td>
							<td class="boldtext" align="right">
									<bean:message key="reference.bankaccount" /> - 
									
									<bean:message key="reference.edit" />
							</td>
						</tr>
					</table>

					<!-- For Error dispplay-->
					<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tablebg">
						<tr align="left" class="tblRow">
							<td>
								<br>
								<html:errors />
							</td>
						</tr>
					</table>

					<table width="100%" border="0" cellpadding="0" cellspacing="0" class="tablebg">
						<tr align="center" class="tblRow">
							<td colspan="5">


								<fieldset id="fstAddress" class="fstStyle">
									<legend>
								
									<bean:message key="bank.account" />
								    <bean:message key="details" />
									::
									<%if (mode.equals("Add")) {%>
									<bean:message key="addmode" />
									<%} else {%>
									<bean:message key="editmode" />
									<%}
									%>
									<bean:message key="entryscreen" />
										
										
									</legend>
									<table width="100%" border="0" cellspacing="0" cellpadding="1" class="tablebg">
										<tr  class="tblRow">
											<td class="textcolor">
											 &nbsp;&nbsp;<bean:message key="accounttype"/>
											</td>
											<td class="textcolor">
												<html:text property="accountType" styleClass="txtinputmand"  altKey="accounttype" readonly="true" size="30"/>
												&nbsp;
											  </td>
											         
											          <td class="textcolor">
											        &nbsp;&nbsp;<bean:message key="bank.branch"/>
											         </td>
											           <td>
															<div id="dropdown">
																<select id="branchname"  Class="txtinputmand"
																	title="<bean:message key='bank.branch'/>" onchange="javascript:onchange_branch();"  altKey="bank.branch"/>
																</select>
																<html:hidden property="branchId" />
																&nbsp;
																
															</div>
															<TD>
																<DIV id="branchImage"></DIV>
															</TD>
															
															 </tr> 
											               
											<tr  class="tblRow">
											<td class="textcolor">
											 &nbsp;&nbsp;<bean:message key="account.number"/>
											</td>
											<td>
											<html:text property="accountNumber" styleClass="txtinputmand" altKey="account.number" onchange="checkNum(this,'accountNo')" size="30" maxlength="20"></html:text></td>
											<td class="textcolor"></td>
										<td class="textcolor"></td><td colspan="2"/>
										</tr>
										<tr  class="tblRow" >
										<td class="textcolor">
										 &nbsp;&nbsp;<bean:message key="account.desc"/>
										</td>
										<td class="textcolor">
											<html:text property="accountDesc" styleClass="txtinput" altKey="account.desc" maxlength="50"   size="30"></html:text>
										</td><td colspan="4"/>
										</tr></table>
								</fieldset>
								<br> 
								<jsp:include page="../../MakerCheckerFields.jsp?form=BankAccountForm" flush="true"></jsp:include>
							</td>							
						</tr>
						<tr class="tblRow">
							<td class="textcolor">
								&nbsp;
								<bean:message key="mandatoryfields" />
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<br>
		<table border="0" cellpadding="0" cellspacing="0" align="right" width="100">
			<tr>
				<td width="50%">
					<html:submit styleClass="buttonStyle" property="submit">
						<bean:message key="submit" />
					</html:submit>&nbsp;
				</td>
				<td width="50%">	
					<html:cancel styleClass="buttonStyle" onclick="bCancel=true">
						<bean:message key="cancel" />
					</html:cancel>
				</td>
				<td><DIV id="layerprivousbutton"></DIV></td>
			</tr>
		</table>
	<html:hidden property="method" value="save" />
	<html:hidden property="effectiveFrom" value="<%=applicationDate%>" />
	<input type="hidden" name="type" value="<%=listType%>" />
	</html:form>

</body>
</html:html>